/*
 * MIT License
 *
 * Copyright (c) 2023 OrdinaryRoad
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: douyin.proto

// Protobuf Java Version: 3.25.3
package tech.ordinaryroad.live.chat.client.codec.douyin.protobuf;

/**
 * Protobuf type {@code TextPiece}
 */
public final class TextPiece extends
    com.google.protobuf.GeneratedMessageV3 implements
    // @@protoc_insertion_point(message_implements:TextPiece)
    TextPieceOrBuilder {
private static final long serialVersionUID = 0L;
  // Use TextPiece.newBuilder() to construct.
  private TextPiece(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }
  private TextPiece() {
    valueRef_ = "";
    stringValue_ = "";
    schemaKey_ = "";
  }

  @Override
  @SuppressWarnings({"unused"})
  protected Object newInstance(
      UnusedPrivateParameter unused) {
    return new TextPiece();
  }

  public static final com.google.protobuf.Descriptors.Descriptor
      getDescriptor() {
    return Douyin.internal_static_TextPiece_descriptor;
  }

  @Override
  protected FieldAccessorTable
      internalGetFieldAccessorTable() {
    return Douyin.internal_static_TextPiece_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            TextPiece.class, Builder.class);
  }

  private int bitField0_;
  public static final int TYPE_FIELD_NUMBER = 1;
  private int type_ = 0;
  /**
   * <code>uint32 type = 1;</code>
   * @return The type.
   */
  @Override
  public int getType() {
    return type_;
  }

  public static final int FORMAT_FIELD_NUMBER = 2;
  private TextFormat format_;
  /**
   * <code>.TextFormat format = 2;</code>
   * @return Whether the format field is set.
   */
  @Override
  public boolean hasFormat() {
    return ((bitField0_ & 0x00000001) != 0);
  }
  /**
   * <code>.TextFormat format = 2;</code>
   * @return The format.
   */
  @Override
  public TextFormat getFormat() {
    return format_ == null ? TextFormat.getDefaultInstance() : format_;
  }
  /**
   * <code>.TextFormat format = 2;</code>
   */
  @Override
  public TextFormatOrBuilder getFormatOrBuilder() {
    return format_ == null ? TextFormat.getDefaultInstance() : format_;
  }

  public static final int VALUE_REF_FIELD_NUMBER = 3;
  @SuppressWarnings("serial")
  private volatile Object valueRef_ = "";
  /**
   * <code>string value_ref = 3;</code>
   * @return The valueRef.
   */
  @Override
  public String getValueRef() {
    Object ref = valueRef_;
    if (ref instanceof String) {
      return (String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      String s = bs.toStringUtf8();
      valueRef_ = s;
      return s;
    }
  }
  /**
   * <code>string value_ref = 3;</code>
   * @return The bytes for valueRef.
   */
  @Override
  public com.google.protobuf.ByteString
      getValueRefBytes() {
    Object ref = valueRef_;
    if (ref instanceof String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (String) ref);
      valueRef_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int STRING_VALUE_FIELD_NUMBER = 11;
  @SuppressWarnings("serial")
  private volatile Object stringValue_ = "";
  /**
   * <code>string string_value = 11;</code>
   * @return The stringValue.
   */
  @Override
  public String getStringValue() {
    Object ref = stringValue_;
    if (ref instanceof String) {
      return (String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      String s = bs.toStringUtf8();
      stringValue_ = s;
      return s;
    }
  }
  /**
   * <code>string string_value = 11;</code>
   * @return The bytes for stringValue.
   */
  @Override
  public com.google.protobuf.ByteString
      getStringValueBytes() {
    Object ref = stringValue_;
    if (ref instanceof String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (String) ref);
      stringValue_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int USERVALUE_FIELD_NUMBER = 21;
  private TextPieceUser uservalue_;
  /**
   * <code>.TextPieceUser uservalue = 21;</code>
   * @return Whether the uservalue field is set.
   */
  @Override
  public boolean hasUservalue() {
    return ((bitField0_ & 0x00000002) != 0);
  }
  /**
   * <code>.TextPieceUser uservalue = 21;</code>
   * @return The uservalue.
   */
  @Override
  public TextPieceUser getUservalue() {
    return uservalue_ == null ? TextPieceUser.getDefaultInstance() : uservalue_;
  }
  /**
   * <code>.TextPieceUser uservalue = 21;</code>
   */
  @Override
  public TextPieceUserOrBuilder getUservalueOrBuilder() {
    return uservalue_ == null ? TextPieceUser.getDefaultInstance() : uservalue_;
  }

  public static final int GIFTVALUE_FIELD_NUMBER = 22;
  private TextPieceGift giftvalue_;
  /**
   * <code>.TextPieceGift giftvalue = 22;</code>
   * @return Whether the giftvalue field is set.
   */
  @Override
  public boolean hasGiftvalue() {
    return ((bitField0_ & 0x00000004) != 0);
  }
  /**
   * <code>.TextPieceGift giftvalue = 22;</code>
   * @return The giftvalue.
   */
  @Override
  public TextPieceGift getGiftvalue() {
    return giftvalue_ == null ? TextPieceGift.getDefaultInstance() : giftvalue_;
  }
  /**
   * <code>.TextPieceGift giftvalue = 22;</code>
   */
  @Override
  public TextPieceGiftOrBuilder getGiftvalueOrBuilder() {
    return giftvalue_ == null ? TextPieceGift.getDefaultInstance() : giftvalue_;
  }

  public static final int HEARTVALUE_FIELD_NUMBER = 23;
  private TextPieceHeart heartvalue_;
  /**
   * <code>.TextPieceHeart heartvalue = 23;</code>
   * @return Whether the heartvalue field is set.
   */
  @Override
  public boolean hasHeartvalue() {
    return ((bitField0_ & 0x00000008) != 0);
  }
  /**
   * <code>.TextPieceHeart heartvalue = 23;</code>
   * @return The heartvalue.
   */
  @Override
  public TextPieceHeart getHeartvalue() {
    return heartvalue_ == null ? TextPieceHeart.getDefaultInstance() : heartvalue_;
  }
  /**
   * <code>.TextPieceHeart heartvalue = 23;</code>
   */
  @Override
  public TextPieceHeartOrBuilder getHeartvalueOrBuilder() {
    return heartvalue_ == null ? TextPieceHeart.getDefaultInstance() : heartvalue_;
  }

  public static final int PATTERNREFVALUE_FIELD_NUMBER = 24;
  private TextPiecePatternRef patternrefvalue_;
  /**
   * <code>.TextPiecePatternRef patternrefvalue = 24;</code>
   * @return Whether the patternrefvalue field is set.
   */
  @Override
  public boolean hasPatternrefvalue() {
    return ((bitField0_ & 0x00000010) != 0);
  }
  /**
   * <code>.TextPiecePatternRef patternrefvalue = 24;</code>
   * @return The patternrefvalue.
   */
  @Override
  public TextPiecePatternRef getPatternrefvalue() {
    return patternrefvalue_ == null ? TextPiecePatternRef.getDefaultInstance() : patternrefvalue_;
  }
  /**
   * <code>.TextPiecePatternRef patternrefvalue = 24;</code>
   */
  @Override
  public TextPiecePatternRefOrBuilder getPatternrefvalueOrBuilder() {
    return patternrefvalue_ == null ? TextPiecePatternRef.getDefaultInstance() : patternrefvalue_;
  }

  public static final int IMAGEVALUE_FIELD_NUMBER = 25;
  private TextPieceImage imagevalue_;
  /**
   * <code>.TextPieceImage imagevalue = 25;</code>
   * @return Whether the imagevalue field is set.
   */
  @Override
  public boolean hasImagevalue() {
    return ((bitField0_ & 0x00000020) != 0);
  }
  /**
   * <code>.TextPieceImage imagevalue = 25;</code>
   * @return The imagevalue.
   */
  @Override
  public TextPieceImage getImagevalue() {
    return imagevalue_ == null ? TextPieceImage.getDefaultInstance() : imagevalue_;
  }
  /**
   * <code>.TextPieceImage imagevalue = 25;</code>
   */
  @Override
  public TextPieceImageOrBuilder getImagevalueOrBuilder() {
    return imagevalue_ == null ? TextPieceImage.getDefaultInstance() : imagevalue_;
  }

  public static final int SCHEMA_KEY_FIELD_NUMBER = 100;
  @SuppressWarnings("serial")
  private volatile Object schemaKey_ = "";
  /**
   * <code>string schema_key = 100;</code>
   * @return The schemaKey.
   */
  @Override
  public String getSchemaKey() {
    Object ref = schemaKey_;
    if (ref instanceof String) {
      return (String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      String s = bs.toStringUtf8();
      schemaKey_ = s;
      return s;
    }
  }
  /**
   * <code>string schema_key = 100;</code>
   * @return The bytes for schemaKey.
   */
  @Override
  public com.google.protobuf.ByteString
      getSchemaKeyBytes() {
    Object ref = schemaKey_;
    if (ref instanceof String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (String) ref);
      schemaKey_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  private byte memoizedIsInitialized = -1;
  @Override
  public final boolean isInitialized() {
    byte isInitialized = memoizedIsInitialized;
    if (isInitialized == 1) return true;
    if (isInitialized == 0) return false;

    memoizedIsInitialized = 1;
    return true;
  }

  @Override
  public void writeTo(com.google.protobuf.CodedOutputStream output)
                      throws java.io.IOException {
    if (type_ != 0) {
      output.writeUInt32(1, type_);
    }
    if (((bitField0_ & 0x00000001) != 0)) {
      output.writeMessage(2, getFormat());
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(valueRef_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 3, valueRef_);
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(stringValue_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 11, stringValue_);
    }
    if (((bitField0_ & 0x00000002) != 0)) {
      output.writeMessage(21, getUservalue());
    }
    if (((bitField0_ & 0x00000004) != 0)) {
      output.writeMessage(22, getGiftvalue());
    }
    if (((bitField0_ & 0x00000008) != 0)) {
      output.writeMessage(23, getHeartvalue());
    }
    if (((bitField0_ & 0x00000010) != 0)) {
      output.writeMessage(24, getPatternrefvalue());
    }
    if (((bitField0_ & 0x00000020) != 0)) {
      output.writeMessage(25, getImagevalue());
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(schemaKey_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 100, schemaKey_);
    }
    getUnknownFields().writeTo(output);
  }

  @Override
  public int getSerializedSize() {
    int size = memoizedSize;
    if (size != -1) return size;

    size = 0;
    if (type_ != 0) {
      size += com.google.protobuf.CodedOutputStream
        .computeUInt32Size(1, type_);
    }
    if (((bitField0_ & 0x00000001) != 0)) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(2, getFormat());
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(valueRef_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, valueRef_);
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(stringValue_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(11, stringValue_);
    }
    if (((bitField0_ & 0x00000002) != 0)) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(21, getUservalue());
    }
    if (((bitField0_ & 0x00000004) != 0)) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(22, getGiftvalue());
    }
    if (((bitField0_ & 0x00000008) != 0)) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(23, getHeartvalue());
    }
    if (((bitField0_ & 0x00000010) != 0)) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(24, getPatternrefvalue());
    }
    if (((bitField0_ & 0x00000020) != 0)) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(25, getImagevalue());
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(schemaKey_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(100, schemaKey_);
    }
    size += getUnknownFields().getSerializedSize();
    memoizedSize = size;
    return size;
  }

  @Override
  public boolean equals(final Object obj) {
    if (obj == this) {
     return true;
    }
    if (!(obj instanceof TextPiece)) {
      return super.equals(obj);
    }
    TextPiece other = (TextPiece) obj;

    if (getType()
        != other.getType()) return false;
    if (hasFormat() != other.hasFormat()) return false;
    if (hasFormat()) {
      if (!getFormat()
          .equals(other.getFormat())) return false;
    }
    if (!getValueRef()
        .equals(other.getValueRef())) return false;
    if (!getStringValue()
        .equals(other.getStringValue())) return false;
    if (hasUservalue() != other.hasUservalue()) return false;
    if (hasUservalue()) {
      if (!getUservalue()
          .equals(other.getUservalue())) return false;
    }
    if (hasGiftvalue() != other.hasGiftvalue()) return false;
    if (hasGiftvalue()) {
      if (!getGiftvalue()
          .equals(other.getGiftvalue())) return false;
    }
    if (hasHeartvalue() != other.hasHeartvalue()) return false;
    if (hasHeartvalue()) {
      if (!getHeartvalue()
          .equals(other.getHeartvalue())) return false;
    }
    if (hasPatternrefvalue() != other.hasPatternrefvalue()) return false;
    if (hasPatternrefvalue()) {
      if (!getPatternrefvalue()
          .equals(other.getPatternrefvalue())) return false;
    }
    if (hasImagevalue() != other.hasImagevalue()) return false;
    if (hasImagevalue()) {
      if (!getImagevalue()
          .equals(other.getImagevalue())) return false;
    }
    if (!getSchemaKey()
        .equals(other.getSchemaKey())) return false;
    if (!getUnknownFields().equals(other.getUnknownFields())) return false;
    return true;
  }

  @Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    hash = (37 * hash) + TYPE_FIELD_NUMBER;
    hash = (53 * hash) + getType();
    if (hasFormat()) {
      hash = (37 * hash) + FORMAT_FIELD_NUMBER;
      hash = (53 * hash) + getFormat().hashCode();
    }
    hash = (37 * hash) + VALUE_REF_FIELD_NUMBER;
    hash = (53 * hash) + getValueRef().hashCode();
    hash = (37 * hash) + STRING_VALUE_FIELD_NUMBER;
    hash = (53 * hash) + getStringValue().hashCode();
    if (hasUservalue()) {
      hash = (37 * hash) + USERVALUE_FIELD_NUMBER;
      hash = (53 * hash) + getUservalue().hashCode();
    }
    if (hasGiftvalue()) {
      hash = (37 * hash) + GIFTVALUE_FIELD_NUMBER;
      hash = (53 * hash) + getGiftvalue().hashCode();
    }
    if (hasHeartvalue()) {
      hash = (37 * hash) + HEARTVALUE_FIELD_NUMBER;
      hash = (53 * hash) + getHeartvalue().hashCode();
    }
    if (hasPatternrefvalue()) {
      hash = (37 * hash) + PATTERNREFVALUE_FIELD_NUMBER;
      hash = (53 * hash) + getPatternrefvalue().hashCode();
    }
    if (hasImagevalue()) {
      hash = (37 * hash) + IMAGEVALUE_FIELD_NUMBER;
      hash = (53 * hash) + getImagevalue().hashCode();
    }
    hash = (37 * hash) + SCHEMA_KEY_FIELD_NUMBER;
    hash = (53 * hash) + getSchemaKey().hashCode();
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static TextPiece parseFrom(
      java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static TextPiece parseFrom(
      java.nio.ByteBuffer data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static TextPiece parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static TextPiece parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static TextPiece parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static TextPiece parseFrom(
      byte[] data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static TextPiece parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static TextPiece parseFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input, extensionRegistry);
  }

  public static TextPiece parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input);
  }

  public static TextPiece parseDelimitedFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
  }
  public static TextPiece parseFrom(
      com.google.protobuf.CodedInputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static TextPiece parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input, extensionRegistry);
  }

  @Override
  public Builder newBuilderForType() { return newBuilder(); }
  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }
  public static Builder newBuilder(TextPiece prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }
  @Override
  public Builder toBuilder() {
    return this == DEFAULT_INSTANCE
        ? new Builder() : new Builder().mergeFrom(this);
  }

  @Override
  protected Builder newBuilderForType(
      BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }
  /**
   * Protobuf type {@code TextPiece}
   */
  public static final class Builder extends
      com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
      // @@protoc_insertion_point(builder_implements:TextPiece)
      TextPieceOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return Douyin.internal_static_TextPiece_descriptor;
    }

    @Override
    protected FieldAccessorTable
        internalGetFieldAccessorTable() {
      return Douyin.internal_static_TextPiece_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              TextPiece.class, Builder.class);
    }

    // Construct using tech.ordinaryroad.live.chat.client.codec.douyin.protobuf.TextPiece.newBuilder()
    private Builder() {
      maybeForceBuilderInitialization();
    }

    private Builder(
        BuilderParent parent) {
      super(parent);
      maybeForceBuilderInitialization();
    }
    private void maybeForceBuilderInitialization() {
      if (com.google.protobuf.GeneratedMessageV3
              .alwaysUseFieldBuilders) {
        getFormatFieldBuilder();
        getUservalueFieldBuilder();
        getGiftvalueFieldBuilder();
        getHeartvalueFieldBuilder();
        getPatternrefvalueFieldBuilder();
        getImagevalueFieldBuilder();
      }
    }
    @Override
    public Builder clear() {
      super.clear();
      bitField0_ = 0;
      type_ = 0;
      format_ = null;
      if (formatBuilder_ != null) {
        formatBuilder_.dispose();
        formatBuilder_ = null;
      }
      valueRef_ = "";
      stringValue_ = "";
      uservalue_ = null;
      if (uservalueBuilder_ != null) {
        uservalueBuilder_.dispose();
        uservalueBuilder_ = null;
      }
      giftvalue_ = null;
      if (giftvalueBuilder_ != null) {
        giftvalueBuilder_.dispose();
        giftvalueBuilder_ = null;
      }
      heartvalue_ = null;
      if (heartvalueBuilder_ != null) {
        heartvalueBuilder_.dispose();
        heartvalueBuilder_ = null;
      }
      patternrefvalue_ = null;
      if (patternrefvalueBuilder_ != null) {
        patternrefvalueBuilder_.dispose();
        patternrefvalueBuilder_ = null;
      }
      imagevalue_ = null;
      if (imagevalueBuilder_ != null) {
        imagevalueBuilder_.dispose();
        imagevalueBuilder_ = null;
      }
      schemaKey_ = "";
      return this;
    }

    @Override
    public com.google.protobuf.Descriptors.Descriptor
        getDescriptorForType() {
      return Douyin.internal_static_TextPiece_descriptor;
    }

    @Override
    public TextPiece getDefaultInstanceForType() {
      return TextPiece.getDefaultInstance();
    }

    @Override
    public TextPiece build() {
      TextPiece result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    @Override
    public TextPiece buildPartial() {
      TextPiece result = new TextPiece(this);
      if (bitField0_ != 0) { buildPartial0(result); }
      onBuilt();
      return result;
    }

    private void buildPartial0(TextPiece result) {
      int from_bitField0_ = bitField0_;
      if (((from_bitField0_ & 0x00000001) != 0)) {
        result.type_ = type_;
      }
      int to_bitField0_ = 0;
      if (((from_bitField0_ & 0x00000002) != 0)) {
        result.format_ = formatBuilder_ == null
            ? format_
            : formatBuilder_.build();
        to_bitField0_ |= 0x00000001;
      }
      if (((from_bitField0_ & 0x00000004) != 0)) {
        result.valueRef_ = valueRef_;
      }
      if (((from_bitField0_ & 0x00000008) != 0)) {
        result.stringValue_ = stringValue_;
      }
      if (((from_bitField0_ & 0x00000010) != 0)) {
        result.uservalue_ = uservalueBuilder_ == null
            ? uservalue_
            : uservalueBuilder_.build();
        to_bitField0_ |= 0x00000002;
      }
      if (((from_bitField0_ & 0x00000020) != 0)) {
        result.giftvalue_ = giftvalueBuilder_ == null
            ? giftvalue_
            : giftvalueBuilder_.build();
        to_bitField0_ |= 0x00000004;
      }
      if (((from_bitField0_ & 0x00000040) != 0)) {
        result.heartvalue_ = heartvalueBuilder_ == null
            ? heartvalue_
            : heartvalueBuilder_.build();
        to_bitField0_ |= 0x00000008;
      }
      if (((from_bitField0_ & 0x00000080) != 0)) {
        result.patternrefvalue_ = patternrefvalueBuilder_ == null
            ? patternrefvalue_
            : patternrefvalueBuilder_.build();
        to_bitField0_ |= 0x00000010;
      }
      if (((from_bitField0_ & 0x00000100) != 0)) {
        result.imagevalue_ = imagevalueBuilder_ == null
            ? imagevalue_
            : imagevalueBuilder_.build();
        to_bitField0_ |= 0x00000020;
      }
      if (((from_bitField0_ & 0x00000200) != 0)) {
        result.schemaKey_ = schemaKey_;
      }
      result.bitField0_ |= to_bitField0_;
    }

    @Override
    public Builder clone() {
      return super.clone();
    }
    @Override
    public Builder setField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        Object value) {
      return super.setField(field, value);
    }
    @Override
    public Builder clearField(
        com.google.protobuf.Descriptors.FieldDescriptor field) {
      return super.clearField(field);
    }
    @Override
    public Builder clearOneof(
        com.google.protobuf.Descriptors.OneofDescriptor oneof) {
      return super.clearOneof(oneof);
    }
    @Override
    public Builder setRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        int index, Object value) {
      return super.setRepeatedField(field, index, value);
    }
    @Override
    public Builder addRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        Object value) {
      return super.addRepeatedField(field, value);
    }
    @Override
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof TextPiece) {
        return mergeFrom((TextPiece)other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(TextPiece other) {
      if (other == TextPiece.getDefaultInstance()) return this;
      if (other.getType() != 0) {
        setType(other.getType());
      }
      if (other.hasFormat()) {
        mergeFormat(other.getFormat());
      }
      if (!other.getValueRef().isEmpty()) {
        valueRef_ = other.valueRef_;
        bitField0_ |= 0x00000004;
        onChanged();
      }
      if (!other.getStringValue().isEmpty()) {
        stringValue_ = other.stringValue_;
        bitField0_ |= 0x00000008;
        onChanged();
      }
      if (other.hasUservalue()) {
        mergeUservalue(other.getUservalue());
      }
      if (other.hasGiftvalue()) {
        mergeGiftvalue(other.getGiftvalue());
      }
      if (other.hasHeartvalue()) {
        mergeHeartvalue(other.getHeartvalue());
      }
      if (other.hasPatternrefvalue()) {
        mergePatternrefvalue(other.getPatternrefvalue());
      }
      if (other.hasImagevalue()) {
        mergeImagevalue(other.getImagevalue());
      }
      if (!other.getSchemaKey().isEmpty()) {
        schemaKey_ = other.schemaKey_;
        bitField0_ |= 0x00000200;
        onChanged();
      }
      this.mergeUnknownFields(other.getUnknownFields());
      onChanged();
      return this;
    }

    @Override
    public final boolean isInitialized() {
      return true;
    }

    @Override
    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      if (extensionRegistry == null) {
        throw new NullPointerException();
      }
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            case 8: {
              type_ = input.readUInt32();
              bitField0_ |= 0x00000001;
              break;
            } // case 8
            case 18: {
              input.readMessage(
                  getFormatFieldBuilder().getBuilder(),
                  extensionRegistry);
              bitField0_ |= 0x00000002;
              break;
            } // case 18
            case 26: {
              valueRef_ = input.readStringRequireUtf8();
              bitField0_ |= 0x00000004;
              break;
            } // case 26
            case 90: {
              stringValue_ = input.readStringRequireUtf8();
              bitField0_ |= 0x00000008;
              break;
            } // case 90
            case 170: {
              input.readMessage(
                  getUservalueFieldBuilder().getBuilder(),
                  extensionRegistry);
              bitField0_ |= 0x00000010;
              break;
            } // case 170
            case 178: {
              input.readMessage(
                  getGiftvalueFieldBuilder().getBuilder(),
                  extensionRegistry);
              bitField0_ |= 0x00000020;
              break;
            } // case 178
            case 186: {
              input.readMessage(
                  getHeartvalueFieldBuilder().getBuilder(),
                  extensionRegistry);
              bitField0_ |= 0x00000040;
              break;
            } // case 186
            case 194: {
              input.readMessage(
                  getPatternrefvalueFieldBuilder().getBuilder(),
                  extensionRegistry);
              bitField0_ |= 0x00000080;
              break;
            } // case 194
            case 202: {
              input.readMessage(
                  getImagevalueFieldBuilder().getBuilder(),
                  extensionRegistry);
              bitField0_ |= 0x00000100;
              break;
            } // case 202
            case 802: {
              schemaKey_ = input.readStringRequireUtf8();
              bitField0_ |= 0x00000200;
              break;
            } // case 802
            default: {
              if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                done = true; // was an endgroup tag
              }
              break;
            } // default:
          } // switch (tag)
        } // while (!done)
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.unwrapIOException();
      } finally {
        onChanged();
      } // finally
      return this;
    }
    private int bitField0_;

    private int type_ ;
    /**
     * <code>uint32 type = 1;</code>
     * @return The type.
     */
    @Override
    public int getType() {
      return type_;
    }
    /**
     * <code>uint32 type = 1;</code>
     * @param value The type to set.
     * @return This builder for chaining.
     */
    public Builder setType(int value) {

      type_ = value;
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }
    /**
     * <code>uint32 type = 1;</code>
     * @return This builder for chaining.
     */
    public Builder clearType() {
      bitField0_ = (bitField0_ & ~0x00000001);
      type_ = 0;
      onChanged();
      return this;
    }

    private TextFormat format_;
    private com.google.protobuf.SingleFieldBuilderV3<
        TextFormat, TextFormat.Builder, TextFormatOrBuilder> formatBuilder_;
    /**
     * <code>.TextFormat format = 2;</code>
     * @return Whether the format field is set.
     */
    public boolean hasFormat() {
      return ((bitField0_ & 0x00000002) != 0);
    }
    /**
     * <code>.TextFormat format = 2;</code>
     * @return The format.
     */
    public TextFormat getFormat() {
      if (formatBuilder_ == null) {
        return format_ == null ? TextFormat.getDefaultInstance() : format_;
      } else {
        return formatBuilder_.getMessage();
      }
    }
    /**
     * <code>.TextFormat format = 2;</code>
     */
    public Builder setFormat(TextFormat value) {
      if (formatBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        format_ = value;
      } else {
        formatBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }
    /**
     * <code>.TextFormat format = 2;</code>
     */
    public Builder setFormat(
        TextFormat.Builder builderForValue) {
      if (formatBuilder_ == null) {
        format_ = builderForValue.build();
      } else {
        formatBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }
    /**
     * <code>.TextFormat format = 2;</code>
     */
    public Builder mergeFormat(TextFormat value) {
      if (formatBuilder_ == null) {
        if (((bitField0_ & 0x00000002) != 0) &&
          format_ != null &&
          format_ != TextFormat.getDefaultInstance()) {
          getFormatBuilder().mergeFrom(value);
        } else {
          format_ = value;
        }
      } else {
        formatBuilder_.mergeFrom(value);
      }
      if (format_ != null) {
        bitField0_ |= 0x00000002;
        onChanged();
      }
      return this;
    }
    /**
     * <code>.TextFormat format = 2;</code>
     */
    public Builder clearFormat() {
      bitField0_ = (bitField0_ & ~0x00000002);
      format_ = null;
      if (formatBuilder_ != null) {
        formatBuilder_.dispose();
        formatBuilder_ = null;
      }
      onChanged();
      return this;
    }
    /**
     * <code>.TextFormat format = 2;</code>
     */
    public TextFormat.Builder getFormatBuilder() {
      bitField0_ |= 0x00000002;
      onChanged();
      return getFormatFieldBuilder().getBuilder();
    }
    /**
     * <code>.TextFormat format = 2;</code>
     */
    public TextFormatOrBuilder getFormatOrBuilder() {
      if (formatBuilder_ != null) {
        return formatBuilder_.getMessageOrBuilder();
      } else {
        return format_ == null ?
            TextFormat.getDefaultInstance() : format_;
      }
    }
    /**
     * <code>.TextFormat format = 2;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
        TextFormat, TextFormat.Builder, TextFormatOrBuilder>
        getFormatFieldBuilder() {
      if (formatBuilder_ == null) {
        formatBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
            TextFormat, TextFormat.Builder, TextFormatOrBuilder>(
                getFormat(),
                getParentForChildren(),
                isClean());
        format_ = null;
      }
      return formatBuilder_;
    }

    private Object valueRef_ = "";
    /**
     * <code>string value_ref = 3;</code>
     * @return The valueRef.
     */
    public String getValueRef() {
      Object ref = valueRef_;
      if (!(ref instanceof String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        String s = bs.toStringUtf8();
        valueRef_ = s;
        return s;
      } else {
        return (String) ref;
      }
    }
    /**
     * <code>string value_ref = 3;</code>
     * @return The bytes for valueRef.
     */
    public com.google.protobuf.ByteString
        getValueRefBytes() {
      Object ref = valueRef_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (String) ref);
        valueRef_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <code>string value_ref = 3;</code>
     * @param value The valueRef to set.
     * @return This builder for chaining.
     */
    public Builder setValueRef(
        String value) {
      if (value == null) { throw new NullPointerException(); }
      valueRef_ = value;
      bitField0_ |= 0x00000004;
      onChanged();
      return this;
    }
    /**
     * <code>string value_ref = 3;</code>
     * @return This builder for chaining.
     */
    public Builder clearValueRef() {
      valueRef_ = getDefaultInstance().getValueRef();
      bitField0_ = (bitField0_ & ~0x00000004);
      onChanged();
      return this;
    }
    /**
     * <code>string value_ref = 3;</code>
     * @param value The bytes for valueRef to set.
     * @return This builder for chaining.
     */
    public Builder setValueRefBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) { throw new NullPointerException(); }
      checkByteStringIsUtf8(value);
      valueRef_ = value;
      bitField0_ |= 0x00000004;
      onChanged();
      return this;
    }

    private Object stringValue_ = "";
    /**
     * <code>string string_value = 11;</code>
     * @return The stringValue.
     */
    public String getStringValue() {
      Object ref = stringValue_;
      if (!(ref instanceof String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        String s = bs.toStringUtf8();
        stringValue_ = s;
        return s;
      } else {
        return (String) ref;
      }
    }
    /**
     * <code>string string_value = 11;</code>
     * @return The bytes for stringValue.
     */
    public com.google.protobuf.ByteString
        getStringValueBytes() {
      Object ref = stringValue_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (String) ref);
        stringValue_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <code>string string_value = 11;</code>
     * @param value The stringValue to set.
     * @return This builder for chaining.
     */
    public Builder setStringValue(
        String value) {
      if (value == null) { throw new NullPointerException(); }
      stringValue_ = value;
      bitField0_ |= 0x00000008;
      onChanged();
      return this;
    }
    /**
     * <code>string string_value = 11;</code>
     * @return This builder for chaining.
     */
    public Builder clearStringValue() {
      stringValue_ = getDefaultInstance().getStringValue();
      bitField0_ = (bitField0_ & ~0x00000008);
      onChanged();
      return this;
    }
    /**
     * <code>string string_value = 11;</code>
     * @param value The bytes for stringValue to set.
     * @return This builder for chaining.
     */
    public Builder setStringValueBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) { throw new NullPointerException(); }
      checkByteStringIsUtf8(value);
      stringValue_ = value;
      bitField0_ |= 0x00000008;
      onChanged();
      return this;
    }

    private TextPieceUser uservalue_;
    private com.google.protobuf.SingleFieldBuilderV3<
        TextPieceUser, TextPieceUser.Builder, TextPieceUserOrBuilder> uservalueBuilder_;
    /**
     * <code>.TextPieceUser uservalue = 21;</code>
     * @return Whether the uservalue field is set.
     */
    public boolean hasUservalue() {
      return ((bitField0_ & 0x00000010) != 0);
    }
    /**
     * <code>.TextPieceUser uservalue = 21;</code>
     * @return The uservalue.
     */
    public TextPieceUser getUservalue() {
      if (uservalueBuilder_ == null) {
        return uservalue_ == null ? TextPieceUser.getDefaultInstance() : uservalue_;
      } else {
        return uservalueBuilder_.getMessage();
      }
    }
    /**
     * <code>.TextPieceUser uservalue = 21;</code>
     */
    public Builder setUservalue(TextPieceUser value) {
      if (uservalueBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        uservalue_ = value;
      } else {
        uservalueBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000010;
      onChanged();
      return this;
    }
    /**
     * <code>.TextPieceUser uservalue = 21;</code>
     */
    public Builder setUservalue(
        TextPieceUser.Builder builderForValue) {
      if (uservalueBuilder_ == null) {
        uservalue_ = builderForValue.build();
      } else {
        uservalueBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000010;
      onChanged();
      return this;
    }
    /**
     * <code>.TextPieceUser uservalue = 21;</code>
     */
    public Builder mergeUservalue(TextPieceUser value) {
      if (uservalueBuilder_ == null) {
        if (((bitField0_ & 0x00000010) != 0) &&
          uservalue_ != null &&
          uservalue_ != TextPieceUser.getDefaultInstance()) {
          getUservalueBuilder().mergeFrom(value);
        } else {
          uservalue_ = value;
        }
      } else {
        uservalueBuilder_.mergeFrom(value);
      }
      if (uservalue_ != null) {
        bitField0_ |= 0x00000010;
        onChanged();
      }
      return this;
    }
    /**
     * <code>.TextPieceUser uservalue = 21;</code>
     */
    public Builder clearUservalue() {
      bitField0_ = (bitField0_ & ~0x00000010);
      uservalue_ = null;
      if (uservalueBuilder_ != null) {
        uservalueBuilder_.dispose();
        uservalueBuilder_ = null;
      }
      onChanged();
      return this;
    }
    /**
     * <code>.TextPieceUser uservalue = 21;</code>
     */
    public TextPieceUser.Builder getUservalueBuilder() {
      bitField0_ |= 0x00000010;
      onChanged();
      return getUservalueFieldBuilder().getBuilder();
    }
    /**
     * <code>.TextPieceUser uservalue = 21;</code>
     */
    public TextPieceUserOrBuilder getUservalueOrBuilder() {
      if (uservalueBuilder_ != null) {
        return uservalueBuilder_.getMessageOrBuilder();
      } else {
        return uservalue_ == null ?
            TextPieceUser.getDefaultInstance() : uservalue_;
      }
    }
    /**
     * <code>.TextPieceUser uservalue = 21;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
        TextPieceUser, TextPieceUser.Builder, TextPieceUserOrBuilder>
        getUservalueFieldBuilder() {
      if (uservalueBuilder_ == null) {
        uservalueBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
            TextPieceUser, TextPieceUser.Builder, TextPieceUserOrBuilder>(
                getUservalue(),
                getParentForChildren(),
                isClean());
        uservalue_ = null;
      }
      return uservalueBuilder_;
    }

    private TextPieceGift giftvalue_;
    private com.google.protobuf.SingleFieldBuilderV3<
        TextPieceGift, TextPieceGift.Builder, TextPieceGiftOrBuilder> giftvalueBuilder_;
    /**
     * <code>.TextPieceGift giftvalue = 22;</code>
     * @return Whether the giftvalue field is set.
     */
    public boolean hasGiftvalue() {
      return ((bitField0_ & 0x00000020) != 0);
    }
    /**
     * <code>.TextPieceGift giftvalue = 22;</code>
     * @return The giftvalue.
     */
    public TextPieceGift getGiftvalue() {
      if (giftvalueBuilder_ == null) {
        return giftvalue_ == null ? TextPieceGift.getDefaultInstance() : giftvalue_;
      } else {
        return giftvalueBuilder_.getMessage();
      }
    }
    /**
     * <code>.TextPieceGift giftvalue = 22;</code>
     */
    public Builder setGiftvalue(TextPieceGift value) {
      if (giftvalueBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        giftvalue_ = value;
      } else {
        giftvalueBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000020;
      onChanged();
      return this;
    }
    /**
     * <code>.TextPieceGift giftvalue = 22;</code>
     */
    public Builder setGiftvalue(
        TextPieceGift.Builder builderForValue) {
      if (giftvalueBuilder_ == null) {
        giftvalue_ = builderForValue.build();
      } else {
        giftvalueBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000020;
      onChanged();
      return this;
    }
    /**
     * <code>.TextPieceGift giftvalue = 22;</code>
     */
    public Builder mergeGiftvalue(TextPieceGift value) {
      if (giftvalueBuilder_ == null) {
        if (((bitField0_ & 0x00000020) != 0) &&
          giftvalue_ != null &&
          giftvalue_ != TextPieceGift.getDefaultInstance()) {
          getGiftvalueBuilder().mergeFrom(value);
        } else {
          giftvalue_ = value;
        }
      } else {
        giftvalueBuilder_.mergeFrom(value);
      }
      if (giftvalue_ != null) {
        bitField0_ |= 0x00000020;
        onChanged();
      }
      return this;
    }
    /**
     * <code>.TextPieceGift giftvalue = 22;</code>
     */
    public Builder clearGiftvalue() {
      bitField0_ = (bitField0_ & ~0x00000020);
      giftvalue_ = null;
      if (giftvalueBuilder_ != null) {
        giftvalueBuilder_.dispose();
        giftvalueBuilder_ = null;
      }
      onChanged();
      return this;
    }
    /**
     * <code>.TextPieceGift giftvalue = 22;</code>
     */
    public TextPieceGift.Builder getGiftvalueBuilder() {
      bitField0_ |= 0x00000020;
      onChanged();
      return getGiftvalueFieldBuilder().getBuilder();
    }
    /**
     * <code>.TextPieceGift giftvalue = 22;</code>
     */
    public TextPieceGiftOrBuilder getGiftvalueOrBuilder() {
      if (giftvalueBuilder_ != null) {
        return giftvalueBuilder_.getMessageOrBuilder();
      } else {
        return giftvalue_ == null ?
            TextPieceGift.getDefaultInstance() : giftvalue_;
      }
    }
    /**
     * <code>.TextPieceGift giftvalue = 22;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
        TextPieceGift, TextPieceGift.Builder, TextPieceGiftOrBuilder>
        getGiftvalueFieldBuilder() {
      if (giftvalueBuilder_ == null) {
        giftvalueBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
            TextPieceGift, TextPieceGift.Builder, TextPieceGiftOrBuilder>(
                getGiftvalue(),
                getParentForChildren(),
                isClean());
        giftvalue_ = null;
      }
      return giftvalueBuilder_;
    }

    private TextPieceHeart heartvalue_;
    private com.google.protobuf.SingleFieldBuilderV3<
        TextPieceHeart, TextPieceHeart.Builder, TextPieceHeartOrBuilder> heartvalueBuilder_;
    /**
     * <code>.TextPieceHeart heartvalue = 23;</code>
     * @return Whether the heartvalue field is set.
     */
    public boolean hasHeartvalue() {
      return ((bitField0_ & 0x00000040) != 0);
    }
    /**
     * <code>.TextPieceHeart heartvalue = 23;</code>
     * @return The heartvalue.
     */
    public TextPieceHeart getHeartvalue() {
      if (heartvalueBuilder_ == null) {
        return heartvalue_ == null ? TextPieceHeart.getDefaultInstance() : heartvalue_;
      } else {
        return heartvalueBuilder_.getMessage();
      }
    }
    /**
     * <code>.TextPieceHeart heartvalue = 23;</code>
     */
    public Builder setHeartvalue(TextPieceHeart value) {
      if (heartvalueBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        heartvalue_ = value;
      } else {
        heartvalueBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000040;
      onChanged();
      return this;
    }
    /**
     * <code>.TextPieceHeart heartvalue = 23;</code>
     */
    public Builder setHeartvalue(
        TextPieceHeart.Builder builderForValue) {
      if (heartvalueBuilder_ == null) {
        heartvalue_ = builderForValue.build();
      } else {
        heartvalueBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000040;
      onChanged();
      return this;
    }
    /**
     * <code>.TextPieceHeart heartvalue = 23;</code>
     */
    public Builder mergeHeartvalue(TextPieceHeart value) {
      if (heartvalueBuilder_ == null) {
        if (((bitField0_ & 0x00000040) != 0) &&
          heartvalue_ != null &&
          heartvalue_ != TextPieceHeart.getDefaultInstance()) {
          getHeartvalueBuilder().mergeFrom(value);
        } else {
          heartvalue_ = value;
        }
      } else {
        heartvalueBuilder_.mergeFrom(value);
      }
      if (heartvalue_ != null) {
        bitField0_ |= 0x00000040;
        onChanged();
      }
      return this;
    }
    /**
     * <code>.TextPieceHeart heartvalue = 23;</code>
     */
    public Builder clearHeartvalue() {
      bitField0_ = (bitField0_ & ~0x00000040);
      heartvalue_ = null;
      if (heartvalueBuilder_ != null) {
        heartvalueBuilder_.dispose();
        heartvalueBuilder_ = null;
      }
      onChanged();
      return this;
    }
    /**
     * <code>.TextPieceHeart heartvalue = 23;</code>
     */
    public TextPieceHeart.Builder getHeartvalueBuilder() {
      bitField0_ |= 0x00000040;
      onChanged();
      return getHeartvalueFieldBuilder().getBuilder();
    }
    /**
     * <code>.TextPieceHeart heartvalue = 23;</code>
     */
    public TextPieceHeartOrBuilder getHeartvalueOrBuilder() {
      if (heartvalueBuilder_ != null) {
        return heartvalueBuilder_.getMessageOrBuilder();
      } else {
        return heartvalue_ == null ?
            TextPieceHeart.getDefaultInstance() : heartvalue_;
      }
    }
    /**
     * <code>.TextPieceHeart heartvalue = 23;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
        TextPieceHeart, TextPieceHeart.Builder, TextPieceHeartOrBuilder>
        getHeartvalueFieldBuilder() {
      if (heartvalueBuilder_ == null) {
        heartvalueBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
            TextPieceHeart, TextPieceHeart.Builder, TextPieceHeartOrBuilder>(
                getHeartvalue(),
                getParentForChildren(),
                isClean());
        heartvalue_ = null;
      }
      return heartvalueBuilder_;
    }

    private TextPiecePatternRef patternrefvalue_;
    private com.google.protobuf.SingleFieldBuilderV3<
        TextPiecePatternRef, TextPiecePatternRef.Builder, TextPiecePatternRefOrBuilder> patternrefvalueBuilder_;
    /**
     * <code>.TextPiecePatternRef patternrefvalue = 24;</code>
     * @return Whether the patternrefvalue field is set.
     */
    public boolean hasPatternrefvalue() {
      return ((bitField0_ & 0x00000080) != 0);
    }
    /**
     * <code>.TextPiecePatternRef patternrefvalue = 24;</code>
     * @return The patternrefvalue.
     */
    public TextPiecePatternRef getPatternrefvalue() {
      if (patternrefvalueBuilder_ == null) {
        return patternrefvalue_ == null ? TextPiecePatternRef.getDefaultInstance() : patternrefvalue_;
      } else {
        return patternrefvalueBuilder_.getMessage();
      }
    }
    /**
     * <code>.TextPiecePatternRef patternrefvalue = 24;</code>
     */
    public Builder setPatternrefvalue(TextPiecePatternRef value) {
      if (patternrefvalueBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        patternrefvalue_ = value;
      } else {
        patternrefvalueBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000080;
      onChanged();
      return this;
    }
    /**
     * <code>.TextPiecePatternRef patternrefvalue = 24;</code>
     */
    public Builder setPatternrefvalue(
        TextPiecePatternRef.Builder builderForValue) {
      if (patternrefvalueBuilder_ == null) {
        patternrefvalue_ = builderForValue.build();
      } else {
        patternrefvalueBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000080;
      onChanged();
      return this;
    }
    /**
     * <code>.TextPiecePatternRef patternrefvalue = 24;</code>
     */
    public Builder mergePatternrefvalue(TextPiecePatternRef value) {
      if (patternrefvalueBuilder_ == null) {
        if (((bitField0_ & 0x00000080) != 0) &&
          patternrefvalue_ != null &&
          patternrefvalue_ != TextPiecePatternRef.getDefaultInstance()) {
          getPatternrefvalueBuilder().mergeFrom(value);
        } else {
          patternrefvalue_ = value;
        }
      } else {
        patternrefvalueBuilder_.mergeFrom(value);
      }
      if (patternrefvalue_ != null) {
        bitField0_ |= 0x00000080;
        onChanged();
      }
      return this;
    }
    /**
     * <code>.TextPiecePatternRef patternrefvalue = 24;</code>
     */
    public Builder clearPatternrefvalue() {
      bitField0_ = (bitField0_ & ~0x00000080);
      patternrefvalue_ = null;
      if (patternrefvalueBuilder_ != null) {
        patternrefvalueBuilder_.dispose();
        patternrefvalueBuilder_ = null;
      }
      onChanged();
      return this;
    }
    /**
     * <code>.TextPiecePatternRef patternrefvalue = 24;</code>
     */
    public TextPiecePatternRef.Builder getPatternrefvalueBuilder() {
      bitField0_ |= 0x00000080;
      onChanged();
      return getPatternrefvalueFieldBuilder().getBuilder();
    }
    /**
     * <code>.TextPiecePatternRef patternrefvalue = 24;</code>
     */
    public TextPiecePatternRefOrBuilder getPatternrefvalueOrBuilder() {
      if (patternrefvalueBuilder_ != null) {
        return patternrefvalueBuilder_.getMessageOrBuilder();
      } else {
        return patternrefvalue_ == null ?
            TextPiecePatternRef.getDefaultInstance() : patternrefvalue_;
      }
    }
    /**
     * <code>.TextPiecePatternRef patternrefvalue = 24;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
        TextPiecePatternRef, TextPiecePatternRef.Builder, TextPiecePatternRefOrBuilder>
        getPatternrefvalueFieldBuilder() {
      if (patternrefvalueBuilder_ == null) {
        patternrefvalueBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
            TextPiecePatternRef, TextPiecePatternRef.Builder, TextPiecePatternRefOrBuilder>(
                getPatternrefvalue(),
                getParentForChildren(),
                isClean());
        patternrefvalue_ = null;
      }
      return patternrefvalueBuilder_;
    }

    private TextPieceImage imagevalue_;
    private com.google.protobuf.SingleFieldBuilderV3<
        TextPieceImage, TextPieceImage.Builder, TextPieceImageOrBuilder> imagevalueBuilder_;
    /**
     * <code>.TextPieceImage imagevalue = 25;</code>
     * @return Whether the imagevalue field is set.
     */
    public boolean hasImagevalue() {
      return ((bitField0_ & 0x00000100) != 0);
    }
    /**
     * <code>.TextPieceImage imagevalue = 25;</code>
     * @return The imagevalue.
     */
    public TextPieceImage getImagevalue() {
      if (imagevalueBuilder_ == null) {
        return imagevalue_ == null ? TextPieceImage.getDefaultInstance() : imagevalue_;
      } else {
        return imagevalueBuilder_.getMessage();
      }
    }
    /**
     * <code>.TextPieceImage imagevalue = 25;</code>
     */
    public Builder setImagevalue(TextPieceImage value) {
      if (imagevalueBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        imagevalue_ = value;
      } else {
        imagevalueBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000100;
      onChanged();
      return this;
    }
    /**
     * <code>.TextPieceImage imagevalue = 25;</code>
     */
    public Builder setImagevalue(
        TextPieceImage.Builder builderForValue) {
      if (imagevalueBuilder_ == null) {
        imagevalue_ = builderForValue.build();
      } else {
        imagevalueBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000100;
      onChanged();
      return this;
    }
    /**
     * <code>.TextPieceImage imagevalue = 25;</code>
     */
    public Builder mergeImagevalue(TextPieceImage value) {
      if (imagevalueBuilder_ == null) {
        if (((bitField0_ & 0x00000100) != 0) &&
          imagevalue_ != null &&
          imagevalue_ != TextPieceImage.getDefaultInstance()) {
          getImagevalueBuilder().mergeFrom(value);
        } else {
          imagevalue_ = value;
        }
      } else {
        imagevalueBuilder_.mergeFrom(value);
      }
      if (imagevalue_ != null) {
        bitField0_ |= 0x00000100;
        onChanged();
      }
      return this;
    }
    /**
     * <code>.TextPieceImage imagevalue = 25;</code>
     */
    public Builder clearImagevalue() {
      bitField0_ = (bitField0_ & ~0x00000100);
      imagevalue_ = null;
      if (imagevalueBuilder_ != null) {
        imagevalueBuilder_.dispose();
        imagevalueBuilder_ = null;
      }
      onChanged();
      return this;
    }
    /**
     * <code>.TextPieceImage imagevalue = 25;</code>
     */
    public TextPieceImage.Builder getImagevalueBuilder() {
      bitField0_ |= 0x00000100;
      onChanged();
      return getImagevalueFieldBuilder().getBuilder();
    }
    /**
     * <code>.TextPieceImage imagevalue = 25;</code>
     */
    public TextPieceImageOrBuilder getImagevalueOrBuilder() {
      if (imagevalueBuilder_ != null) {
        return imagevalueBuilder_.getMessageOrBuilder();
      } else {
        return imagevalue_ == null ?
            TextPieceImage.getDefaultInstance() : imagevalue_;
      }
    }
    /**
     * <code>.TextPieceImage imagevalue = 25;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
        TextPieceImage, TextPieceImage.Builder, TextPieceImageOrBuilder>
        getImagevalueFieldBuilder() {
      if (imagevalueBuilder_ == null) {
        imagevalueBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
            TextPieceImage, TextPieceImage.Builder, TextPieceImageOrBuilder>(
                getImagevalue(),
                getParentForChildren(),
                isClean());
        imagevalue_ = null;
      }
      return imagevalueBuilder_;
    }

    private Object schemaKey_ = "";
    /**
     * <code>string schema_key = 100;</code>
     * @return The schemaKey.
     */
    public String getSchemaKey() {
      Object ref = schemaKey_;
      if (!(ref instanceof String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        String s = bs.toStringUtf8();
        schemaKey_ = s;
        return s;
      } else {
        return (String) ref;
      }
    }
    /**
     * <code>string schema_key = 100;</code>
     * @return The bytes for schemaKey.
     */
    public com.google.protobuf.ByteString
        getSchemaKeyBytes() {
      Object ref = schemaKey_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (String) ref);
        schemaKey_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <code>string schema_key = 100;</code>
     * @param value The schemaKey to set.
     * @return This builder for chaining.
     */
    public Builder setSchemaKey(
        String value) {
      if (value == null) { throw new NullPointerException(); }
      schemaKey_ = value;
      bitField0_ |= 0x00000200;
      onChanged();
      return this;
    }
    /**
     * <code>string schema_key = 100;</code>
     * @return This builder for chaining.
     */
    public Builder clearSchemaKey() {
      schemaKey_ = getDefaultInstance().getSchemaKey();
      bitField0_ = (bitField0_ & ~0x00000200);
      onChanged();
      return this;
    }
    /**
     * <code>string schema_key = 100;</code>
     * @param value The bytes for schemaKey to set.
     * @return This builder for chaining.
     */
    public Builder setSchemaKeyBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) { throw new NullPointerException(); }
      checkByteStringIsUtf8(value);
      schemaKey_ = value;
      bitField0_ |= 0x00000200;
      onChanged();
      return this;
    }
    @Override
    public final Builder setUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.setUnknownFields(unknownFields);
    }

    @Override
    public final Builder mergeUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.mergeUnknownFields(unknownFields);
    }


    // @@protoc_insertion_point(builder_scope:TextPiece)
  }

  // @@protoc_insertion_point(class_scope:TextPiece)
  private static final TextPiece DEFAULT_INSTANCE;
  static {
    DEFAULT_INSTANCE = new TextPiece();
  }

  public static TextPiece getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<TextPiece>
      PARSER = new com.google.protobuf.AbstractParser<TextPiece>() {
    @Override
    public TextPiece parsePartialFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      Builder builder = newBuilder();
      try {
        builder.mergeFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.setUnfinishedMessage(builder.buildPartial());
      } catch (com.google.protobuf.UninitializedMessageException e) {
        throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
      } catch (java.io.IOException e) {
        throw new com.google.protobuf.InvalidProtocolBufferException(e)
            .setUnfinishedMessage(builder.buildPartial());
      }
      return builder.buildPartial();
    }
  };

  public static com.google.protobuf.Parser<TextPiece> parser() {
    return PARSER;
  }

  @Override
  public com.google.protobuf.Parser<TextPiece> getParserForType() {
    return PARSER;
  }

  @Override
  public TextPiece getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }

}

